package com.water.devtool.define;

import java.util.HashMap;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@JsonIgnoreProperties(ignoreUnknown = true)
public class LevelConfig {
	private String level;
	private String name;// 用作类名的后缀，如UserDao
	private String rootPath;// 根目录，如src的目录
	private String pathStyle; // 路径风格，如packagePath，或者纯路径
	private String templateFile;
	private String fileFormat;
	private int orderNo;
	private String fileName;
	private String lastPack;

	public String getLastPack() {
		return lastPack;
	}

	public void setLastPack(String lastPack) {
		this.lastPack = lastPack;
	}

	public String getLevel() {
		return level;
	}

	public void setLevel(String level) {
		this.level = level;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getRootPath() {
		return rootPath;
	}

	public void setRootPath(String rootPath) {
		this.rootPath = rootPath;
	}

	public String getPathStyle() {
		return pathStyle;
	}

	public void setPathStyle(String pathStyle) {
		this.pathStyle = pathStyle;
	}

	public static Map<String, LevelConfig> defaultConfig() {
		Map<String, LevelConfig> map = new HashMap<String, LevelConfig>();

		LevelConfig bean = new LevelConfig();
		bean.setLevel("bean");
		bean.setName("bean");
		bean.setTemplateFile("bean");
		bean.setFileFormat("java");
		bean.setPathStyle("{#packagePath}");
		bean.setRootPath("src/main/java");
		map.put(bean.getLevel(), bean);

		LevelConfig dao = new LevelConfig();
		dao.setLevel("dao");
		dao.setName("dao");
		dao.setTemplateFile("dao");
		dao.setFileFormat("java");
		dao.setPathStyle("{#packagePath}");
		dao.setRootPath("src/main/java");
		map.put(dao.getLevel(), dao);

		LevelConfig service = new LevelConfig();
		service.setLevel("service");
		service.setName("service");
		service.setTemplateFile("service");
		service.setFileFormat("java");
		service.setPathStyle("{#packagePath}");
		service.setRootPath("src/main/java");
		map.put(service.getLevel(), service);

		LevelConfig action = new LevelConfig();
		action.setLevel("action");
		action.setName("action");
		action.setTemplateFile("action");
		action.setFileFormat("java");
		action.setPathStyle("{#packagePath}");
		action.setRootPath("src/main/java");
		map.put(action.getLevel(), action);

		LevelConfig jsp = new LevelConfig();
		jsp.setLevel("jsp");
		jsp.setName("jsp");
		jsp.setTemplateFile("jsp");
		jsp.setFileFormat("jsp");
		jsp.setPathStyle("{#modularPath}");
		jsp.setRootPath("WebContent");
		map.put(jsp.getLevel(), jsp);

		LevelConfig serviceTest = new LevelConfig();
		serviceTest.setLevel("serviceTest");
		serviceTest.setName("serviceTest");
		serviceTest.setTemplateFile("serviceTest");
		serviceTest.setFileFormat("java");
		serviceTest.setPathStyle("{#packagePath}");
		serviceTest.setRootPath("src/test/java");
		map.put(serviceTest.getLevel(), serviceTest);
		
		LevelConfig mapper = new LevelConfig();
		mapper.setLevel("mapper");
		mapper.setName("mapper");
		mapper.setTemplateFile("mapper");
		mapper.setFileFormat("xml");
		mapper.setPathStyle("{#packagePath}");
		mapper.setRootPath("src/main/resources/mappings");
		map.put(mapper.getLevel(), mapper);
		return map;
	}

	public String getTemplateFile() {
		return templateFile;
	}

	public void setTemplateFile(String templateFile) {
		this.templateFile = templateFile;
	}

	public String getFileFormat() {
		return fileFormat;
	}

	public void setFileFormat(String fileFormat) {
		this.fileFormat = fileFormat;
	}

	public int getOrderNo() {
		return orderNo;
	}

	public void setOrderNo(int orderNo) {
		this.orderNo = orderNo;
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

}
